package com.example.administrator.newfragmentation.fragment.zhihu.second.child.childpager;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.example.administrator.newfragmentation.R;
import com.example.administrator.newfragmentation.fragmentMain.BaseFragment;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Created by YoKeyword on 16/6/30.
 */
public class OtherPagerFragment extends BaseFragment {

    private static final String ARG_TYPE = "arg_pos";
    public static int TYPE_HOT = 1;
    public static int TYPE_FAV = 2;
    @Bind(R.id.tv_title)
    TextView tvTitle;

    private int mType = TYPE_HOT;

    public static OtherPagerFragment newInstance(int position) {

        Bundle args = new Bundle();
        args.putInt(ARG_TYPE,position);
        OtherPagerFragment fragment = new OtherPagerFragment();
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if(getArguments() != null){
            mType = getArguments().getInt(ARG_TYPE);
        }
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.wechat_fragment_tab_second_pager_other, container, false);
        ButterKnife.bind(this, view);
        return view;
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        if (mType == TYPE_HOT) {
            tvTitle.setText("热门");
        } else {
            tvTitle.setText("收藏");
        }
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        ButterKnife.unbind(this);
    }
}
